package com.yzh.recursion;

/**
 * @author 于振晗
 * @title: Recursion
 * @description: TODO 递归测试
 * @date 2020年09月01日
 * @path com.yzh
 */
public class Recursion {
    public static void main(String[] args) {


        //斐波那契数列
        int n = 6;
        int fac = fac(n);
        System.out.println(fac);
    }

    public static int fac(int n){
        if(n ==1 || n == 2){
            return 1;
        }else{
            return fac(n-1)+fac(n-2);
        }
    }
}
